url = "http://www.netbian.com/mei/"
import requests
from lxml import etree

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
}

resp = requests.get(url, headers=headers)
resp.encoding = "gbk"
print(resp.text)

xp = etree.HTML(resp.text)

img_urls = xp.xpath('//ul/li/a/img/@src')
img_names = xp.xpath('//ul/li/a/img/@alt')

for u,n in zip(img_urls,img_names):
    print(f'下载{n}图片')
    img_resp = requests.get(u, headers=headers)
    with open(f'./img/{n}.jpg', 'wb') as f:
        f.write(img_resp.content)